home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Games / WBTriz_V07b / SDK / SDK.ab2 < prev    next >
Text File  |  2002-10-27  |  4KB  |  169 lines

  1.  
  2. ; use resident "amigalibs.res"
  3.  
  4. optimize 3
  5.  
  6. Goto SkipVer
  7. Dc.b "$VER:WBTRIZ_SDK v0.0 (09.09.2002) [68K/AGA] by RAZIEL"
  8. Even
  9. SkipVer
  10.  
  11. #DTM_FrameBox  =$601
  12. #OBP_Precision =$84000000
  13.  
  14. DEFTYPE.l
  15. DEFTYPE.BitMapHeader   *bmhd
  16. DEFTYPE.dtFrameBox     dtf
  17. DEFTYPE.gpLayout       gpl
  18. DEFTYPE.BitMap         *bm
  19. DEFTYPE.DataTypeHeader *dth
  20. DEFTYPE.DataType       *dtn
  21. DEFTYPE.RastPort       rp
  22.  
  23. Dim attrs.TagItem(6),*SOBJ(3)
  24.  
  25. WBStartup:WbToScreen 0
  26.  
  27. ; get some stats for WB
  28.  
  29. *scr.Screen         = Peek.l(Addr Screen(0))
  30. diswid              = *scr\Width                              ;ScreenWidth
  31. dishit              = *scr\Height                             ;ScreenHeight
  32. disdep              = *scr\BitMap\Depth                       ;WBDepth
  33. HFONT               = *scr\Font\ta_YSize
  34.  
  35. attrs(0)\ti_Tag = #DTA_SourceType,#DTST_FILE
  36. attrs(1)\ti_Tag = #DTA_GroupID,#GID_PICTURE
  37. attrs(2)\ti_Tag = #PDTA_Remap,-1
  38. attrs(3)\ti_Tag = #PDTA_Screen,*scr
  39. attrs(4)\ti_Tag = #OBP_Precision,-1 ; *** -1=Exact(Best) 0=Image(Good) 16=Icon(Poor) 32=GUI(Poor) ***
  40. attrs(5)\ti_Tag = #TAG_DONE,0
  41.  
  42. Function BM_2_BM {*SrcB,SrcW,SrcH,*DestB,DestW,DestH} ; *** Copy bitmap & scale it ***
  43.  
  44.   success=0
  45.   If *SrcB
  46.     BSA.BitScaleArgs\bsa_SrcX=0
  47.     BSA\bsa_SrcY=0
  48.     BSA\bsa_SrcWidth=SrcW
  49.     BSA\bsa_SrcHeight=SrcH
  50.     BSA\bsa_XSrcFactor=SrcW
  51.     BSA\bsa_YSrcFactor=SrcH
  52.     BSA\bsa_DestX=0
  53.     BSA\bsa_DestY=0
  54.     BSA\bsa_DestWidth=DestW
  55.     BSA\bsa_DestHeight=DestH
  56.     BSA\bsa_XDestFactor=DestW
  57.     BSA\bsa_YDestFactor=DestH
  58.     BSA\bsa_SrcBitMap=*SrcB
  59.     BSA\bsa_DestBitMap=*DestB
  60.     BitMapScale_ &BSA
  61.     success=1
  62.   End If
  63.   Function Return success
  64. End Function
  65.  
  66. Buffer 0,32000
  67.  
  68. scalex=0 ; change this to scale x in pixel
  69. scaley=0 ; change this to scale y in pixel
  70. TITLE$="WBTZ·SDK ;))"
  71.  
  72. For r=0 To 1
  73. name$=Str$(r):If Exists(name$) Then Gosub DTREMAP Else Goto FIN
  74. Next
  75.  
  76. bmw=ShapeWidth(0):bmh=ShapeHeight(0):fwinh=bmh+HFONT+5
  77. BitMap 0,bmw,bmh,disdep
  78.  
  79. Blit 0,0,0 ; *** Draw background ***
  80.  
  81. succ=Window(0,ScreenWidth/2-bmw/2,ScreenHeight/2-fwinh/2,bmw,fwinh,$200000|$2|$6,TITLE$,1,2)
  82.  
  83. If succ
  84. sw=ShapeWidth(1):sh=ShapeHeight(1)
  85. x=0:y=bmh-sh:mov=0
  86.  
  87. Repeat
  88.  
  89. If mov=0 ; *** move object ***
  90. If x+sw<InnerWidth Then x+2 Else mov=1
  91. Else
  92. If x>1 Then x-2 Else mov=0
  93. EndIf
  94.  
  95. BBlit 0,1,x,y ; *** Draw test object (transparent 0 colour) ***
  96.  
  97. BitMaptoWindow 0,0,0,0,4,HFONT+3,InnerWidth,InnerHeight ; *** put bitmap to window ***
  98.  
  99. Delay_ 1
  100. UnBuffer 0
  101. Until RawStatus($45) ; *** ESC to exit ***
  102. Else
  103. NPrint "Unable to open window..."
  104. EndIf
  105.  
  106. Goto FIN
  107.  
  108. .DTREMAP
  109.  
  110. lock.l=Lock_(&name$,#ACCESS_READ)
  111.  
  112.   If lock
  113.     *dtn=ObtainDataTypeA_(#DTST_FILE,lock,0)
  114.     If *dtn
  115.       *dth=*dtn\dtn_Header
  116.       GroupID$=Left$(Peek$(&*dth\dth_GroupID),4)
  117.       If GroupID$="pict"
  118.         *obj=NewDTObjectA_(&name$,attrs(0))
  119.         If *obj
  120.           dtf\MethodID=#DTM_FrameBox
  121.           DoDTMethodA_ *obj,0,0,&dtf
  122.           gpl\MethodID=#DTM_PROCLAYOUT
  123.           gpl\gpl_GInfo=0
  124.           gpl\gpl_Initial=1
  125.           DoDTMethodA_ *obj,0,0,&gpl
  126.           GetAttr_ #PDTA_BitMapHeader,*obj,&*bmhd
  127.           GetAttr_ #PDTA_BitMap,*obj,&*bm
  128.           bmw.l=*bmhd\bmh_Width
  129.           bmh.l=*bmhd\bmh_Height
  130.           bmd.l=*bmhd\bmh_Depth
  131.  
  132.           BitMap 0,bmw+scalex,bmh+scaley,disdep
  133.           *bm1=Addr BitMap(0)
  134.  
  135.       If *bm1
  136.  
  137.          success=BM_2_BM {*bm,bmw,bmh,*bm1,bmw+scalex,bmh+scaley}
  138.  
  139.     GetaShape r,0,0,bmw+scalex,bmh+scaley
  140.  
  141.       EndIf
  142.  
  143.       *SOBJ(r)=*obj
  144.  
  145.         Else succ=Request(TITLE$,"Couldn't create datatype object!",OK$):Goto FIN
  146.         End If
  147.       Else succ=Request(TITLE$,"This is "+Chr$(34)+name$+Chr$(34)+" not an image file!",OK$):UnLock_ lock.l:Goto FIN
  148.       End If
  149.       ReleaseDataType_ *dtn
  150.     Else succ=Request(TITLE$,"Couldn't get datatype!",OK$):Goto FIN
  151.     End If
  152.     UnLock_ lock
  153.   Else succ=Request(TITLE$,"Couldn't get file lock!",OK$):Goto FIN
  154.   End If
  155.  
  156. Return
  157.  
  158.  
  159. .FIN
  160. For work=0 To r-1
  161. DisposeDTObject_ *SOBJ(work)
  162. Next
  163. CloseWindow 0:Free BitMap 0:End
  164.  
  165.  
  166.  
  167.  
  168.  
  169.